package com.hy.springboot;

import com.hy.springboot.service.TestService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

/**
 * Created With IntelliJ IDEA.
 * Descriptions:
 * author: Mr.Du
 * Date: 2023/5/30
 * Time: 23:45
 */
@Slf4j
@SpringBootApplication
public class TestAutoConfigurationApplication {
    
    @Value("${debug}")
    private boolean debug;
    
    public static void main(String[] args) {
        SpringApplication.run(TestAutoConfigurationApplication.class, args);
    }
    
    @Bean
    public CommandLineRunner commandLineRunner(TestService testService) {
        return (args) -> {
            log.info("debug mode: {}", debug);
            log.info(testService.getServiceName());
        };
    }
}
